package com.example.expandablelistview.activity;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;

public class StateView extends View {
	private Paint paint;
	private int ptX;
	private float ptY;

	public StateView(Context context) {
		super(context);
		paint = new Paint(Paint.ANTI_ALIAS_FLAG);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(ptX, ptY, 16, paint);
	}

	public int getPtX() {
		return ptX;
	}

	public void setPtX(int ptX) {
		this.ptX = ptX;
	}

	public float getPtY() {
		return ptY;
	}

	public void setPtY(float ptY) {
		this.ptY = ptY;
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		super.onTouchEvent(event);
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			ptX = (int) event.getX();
			ptY = (int) event.getY();
			invalidate();
			return true;
		}
		return false;
	}

}
